<?php include('./templete/public/head.php')?>
<body>

<!--搜索-->
<div class="comm-search">
    <div class="search-input">
        <i class="iconfont icon-sousuo"></i>
        <input type="text" name="" id="title" value="<?php echo input('title')?>" placeholder="请输入您要搜索的建议" onchange="search()"/>
    </div>
</div>
<!--搜索标签-->
<div class="search-tag">
    <div class="tag1">
        <a <?php if ($model == 1){ ?>class="active"<?php } ?> href="<?php echo url('jdz/myjdz', ['model' => 1]) ?>">我提出的</a>
        <a <?php if ($model == 2){ ?>class="active"<?php } ?> href="<?php echo url('jdz/myjdz', ['model' => 2]) ?>">我实施的</a>
    </div>
</div>
<hr class="bgcolor"/>

<!--最热提议-->
<div class="index-main hot-proposal">
    <div class="main-content proposal-content">
        <div class="c-list">

        </div>
    </div>
</div>

</body>

</html>
<script>

    get_jdz_list();
    function get_jdz_list() {
        var title = $("#title").val();
        $.ajax({
            url:'<?php echo url('jdz/get_all_list')?>',
            data:{
                title:title,
                ismy:1,model:<?php echo $model?>
            },
            type:'post',
            success:function (data) {
                $(".c-list").html(data);
            }
        })
    }
    function search() {
        var title=$('#title').val();
        window.location.href="/index/jdz/myjdz.html?title="+title+"&model="+"<?php echo $model?>";
    }
    $(function() {
        var page = 2;
        var load_flag = true;
        $(window).scroll(function() {
            var title = $("#title").val();
            var totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
            var documentheight = parseFloat($(document).height());
            if (documentheight - totalheight <= 200) {
                if(load_flag){
                    load_flag=!load_flag;
                    $.ajax({
                        url:'<?php echo url('jdz/get_all_list')?>',
                        data:{
                            title:title,
                            page:page,ismy:1,model:<?php echo $model?>
                        },
                        type:'post',
                        success: function(data) {
                            console.log(data);
                            $(".c-list").append(data);
                            page++;
                            load_flag=!load_flag;
                        }
                    })
                }

            }
        });
    });

</script>